package com.example.openim;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication(scanBasePackages={"com.example","com.example.openim"})
@Slf4j
public class WebApplication {

    public static void main(String[] args) throws UnknownHostException {
        SpringApplication app = new SpringApplication(WebApplication.class);
        Environment env = app.run(args).getEnvironment();
        String port = env.getProperty("server.port");
        log.info("Service Provider: Access URLs:\n----------------------------------------------------------\n\t" +
                        "Local: \t\t\thttp://localhost:{}\n\t" +
                        "Local: \t\t\thttp://{}:{}\n" +
                        "----------------------------------------------------------",
                port,
                InetAddress.getLocalHost().getHostAddress(),
                port
        );
    }

}
